unit AddCDocFrm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters,
  dxSkinsCore, dxSkinOffice2007Black, dxSkinOffice2007Blue,
  dxSkinOffice2007Green, dxSkinOffice2007Pink, dxSkinOffice2007Silver,
  dxSkinOffice2010Black, dxSkinOffice2010Blue, dxSkinOffice2010Silver,
  dxSkinscxPCPainter, cxContainer, cxEdit, dxLayoutcxEditAdapters,
  dxLayoutControl, Menus, StdCtrls, cxButtons, cxMaskEdit, cxDropDownEdit,
  cxCalendar, cxTextEdit, FIBQuery, pFIBCacheQueries, dxLayoutControlAdapters,
  dxLayoutContainer;

type
  TAddCDocForm = class(TForm)
    dxLayoutControl1Group_Root: TdxLayoutGroup;
    dxLayoutControl1: TdxLayoutControl;
    NEdit: TcxTextEdit;
    dxLayoutControl1Item1: TdxLayoutItem;
    DEdit: TcxDateEdit;
    dxLayoutControl1Item2: TdxLayoutItem;
    cxButton1: TcxButton;
    dxLayoutControl1Item3: TdxLayoutItem;
    cxButton2: TcxButton;
    dxLayoutControl1Item4: TdxLayoutItem;
    procedure FormCreate(Sender: TObject);
    procedure cxButton1Click(Sender: TObject);
    procedure cxButton2Click(Sender: TObject);
  private
    { Private declarations }
  public
    procedure AddCDoc;
  end;

var
  AddCDocForm: TAddCDocForm;

implementation

uses
  MainFrm, VDB;

{$R *.dfm}

procedure TAddCDocForm.AddCDoc;
begin
  with DBUnit.CDoc do
  begin
    Append;
    FN('Nomer').AsString:=NEdit.EditValue;
    FN('Data').AsDateTime:=DEdit.EditValue;
    Post;
  end;
end;

procedure TAddCDocForm.cxButton1Click(Sender: TObject);
begin
  AddCDoc;
  ModalResult:=mrOk;
end;

procedure TAddCDocForm.cxButton2Click(Sender: TObject);
begin
  ModalResult:=mrCancel;
end;

procedure TAddCDocForm.FormCreate(Sender: TObject);
begin
  NEdit.EditValue:='';
  DEdit.EditValue:=Date;
end;

end.
